<div class="dialog-wrap">
    <form class="layui-form pt-25">
        <div class="layui-form-item">
            <label class="layui-form-label">系统语言</label>
            <div class="layui-input-block pl-20">
                <input type="radio" name="language" value="0" title="简体中文" checked>
                <input type="radio" name="language" value="1" title="繁體中文">
                <input type="radio" name="language" value="2" title="English">
            </div>
        </div>
        <div class="layui-form-item layui-hide">
            <div class="layui-input-block">
                <button class="layui-btn layui-btn-xs" lay-submit lay-filter="formSub">立即提交</button>
            </div>
        </div>
    </form>
</div>
<script>
    layui.use(['form', 'utils'], function () {
        var $ = layui.jquery,
            form = layui.form,
            layer = layui.layer,
            utils = layui.utils;

        var parentIndex = layer.index;

        form.render(); // 初始化表单

        form.on('submit(formSub)', function(data){
            utils.Ajax({
                url: 'api/common/message.json',
                dataType: 'json',
                type: 'post',
                data: data.field,
                success: function (response) {
                    layer.msg(response.message);
                    layer.close(parentIndex)
                }
            });
            return false;
        });
    })
</script>
